﻿using System;
using System.Runtime.InteropServices;

namespace Caius.Core.Events
{
    /// <summary>
    /// Генератор внешнего события 
    /// </summary>
    public static class EventGenerator
    {
        /// <summary>
        /// Генерация внешнего события
        /// </summary>
        /// <param name="message"></param>
        /// <param name="data"></param>
        public static void GenerateExtEvent(String message, String data)
        {
            try
            {
                ExternalAddIn.ExtEvent.ExternalEvent(@"AsteriskManager", message, data);
            }
            catch
            {
                throw new COMException(string.Format(@"Failed to execute GenerateExtEvent() method with message <{0}>", message));
            }
        }
    }
}
